from peewee import CharField

from application.db import get_database_connection
from application.db.mysql_db.base_mysql_model import BaseMysqlModel


class CnArticleKeywordsRelation(BaseMysqlModel):
    """中文文献库文献关键词关系表"""
    article_id = CharField(max_length=32, index=True)  # 文献ID，表cn_article_list标识
    keyword_id = CharField(max_length=32, index=True)  # 关键词ID，表cn_article_keywords_list标识
    
    class Meta:
        table_name = 'cn_article_keywords_relation'
        database = get_database_connection('default')  # 使用默认数据库

if __name__ == '__main__':
    data = CnArticleKeywordsRelation.select().dicts()
    for i in data:
        print(i)
        break